FROM node:12.8

# 替换镜像，修改时区
ENV TZ=Asia/Shanghai
RUN set -eux; \
    ln -snf /usr/share/zoneinfo/$TZ /etc/localtime; \
    echo $TZ > /etc/timezone;

# 换源
RUN echo "deb http://mirrors.163.com/debian/ stretch main non-free contrib\n\
deb http://mirrors.163.com/debian/ stretch-updates main non-free contrib\n\
deb http://mirrors.163.com/debian/ stretch-backports main non-free contrib\n\
deb-src http://mirrors.163.com/debian/ stretch main non-free contrib\n\
deb-src http://mirrors.163.com/debian/ stretch-updates main non-free contrib\n\
deb-src http://mirrors.163.com/debian/ stretch-backports main non-free contrib\n\
deb http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib\n\
deb-src http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib\n\
" > /etc/apt/sources.list

# 配置私服
RUN npm config set registry http://106.55.191.71:4873/

COPY package*.json index.js ./

RUN npm install --production

# 将dist及config目录复制到镜像中
COPY dist ./dist/
COPY config ./config/

CMD ["node", "index.js"]
